package com.huanwei.login_regist;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.widget.TextView;

import com.huanwei.mini.R;
import com.huanwei.mini.adapter.Recycle_Threeadapter;
import com.huanwei.mini.http.ML;
import com.huanwei.mini.interfaces.OnItemClickListener2;
import com.huanwei.rizhi.RiZhiListActivity;
import com.huanwei.rizhi.RizhiActivity;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class Three_Activity extends AppCompatActivity {
    List<ML.SdataBean.FirstBean.SecondBean.ThirdBean> mReviewWords;
    @BindView(R.id.recycleview)
    RecyclerView recycleview;
    @BindView(R.id.tv)
    TextView tv;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_three);
        ButterKnife.bind(this);
        Intent intent = getIntent();
        mReviewWords = (List<ML.SdataBean.FirstBean.SecondBean.ThirdBean>) intent.getSerializableExtra("words");
        String words2 = intent.getStringExtra("words2");
        tv.setText(words2);

        GridLayoutManager gridLayoutManager = new GridLayoutManager(Three_Activity.this, 4);
        gridLayoutManager.setAutoMeasureEnabled(true);
        Recycle_Threeadapter demoAdapter = new Recycle_Threeadapter(mReviewWords);
        recycleview.setLayoutManager(gridLayoutManager);
        recycleview.setAdapter(demoAdapter);
        demoAdapter.setOnItemClickListener(new OnItemClickListener2() {
            @Override
            public void onItemClick(View view, int position) {
                String menuname = mReviewWords.get(position).getMenuname();
                switch (menuname) {
                    case "工作日志列表":
                        startActivity(new Intent(Three_Activity.this, RiZhiListActivity.class));

                        break;
                    case "写日志":
                        startActivity(new Intent(Three_Activity.this, RizhiActivity.class));

                        break;
                    case "实时考勤":
                        startActivity(new Intent(Three_Activity.this, KaoQinActivity.class));

                        break;


                    default:
                        break;
                }

            }
        });
    }
}
